package cz.muni.fi.pa165.musiclibrary.api.dao;

import cz.muni.fi.pa165.musiclibrary.api.entities.Author;
import java.util.List;

/**
 * This service allows to manipulate with authors.
 * 
 * @author xmacejov
 */
public interface AuthorDAO {
    
     /**
     * Stores new author into database. Id for the new author is automatically
     * generated and stored into id attribute.
     * 
     * @param author author to be created.
     * @throws IllegalArgumentException when author is null or author is without name.
     * @throws IllegalEntityException when author has already assigned id.
     */   
    public void createAuthor(Author author);
    
     /**
     * Returns author with given id.
     * 
     * @param id primary key of requested author.
     * @return author with given id or null if author does not exist.
     * @throws IllegalArgumentException when given id is null.
     */   
    public Author getAuthor(Long id);
    
     /**
     * Returns list of all authors in the database.
     * 
     * @return list of all authors in database.
     */
    public List<Author> getAllAuthors();

     /**
     * Updates author in database.
     * 
     * @param author updated author to be stored into database.
     * @throws IllegalArgumentException when author is null, has null id or author without name.
     * @throws IllegalEntityException when author does not exist in the database.
     */   
    public void updateAuthor(Author author);
    
     /**
     * Deletes author from database. 
     * 
     * @param author author to be deleted from db.
     * @throws IllegalArgumentException when author is null, author has null id or author does not exist in the database.
     */   
    public void deleteAuthor(Author author);
}
